import 'package:flutter/material.dart';

class ListViewSeparated extends StatelessWidget {

  final Divider blueColorDiv = const Divider(color: Colors.blue,);
  final Divider redColorDiv = const Divider(color: Colors.red,);


  ListViewSeparated({Key ? key}) : super(key : key){

  }


  @override
  Widget build(BuildContext context) {

    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            leading: IconButton(
              onPressed: (){},
              icon: const Icon(Icons.ac_unit,color: Colors.cyanAccent,),
            ),
          ),
          body:ListView.separated(
              itemBuilder: (BuildContext context,int index){
                return ListTile(
                  leading: const Icon(Icons.people),
                  title: Text("联系人${index+1}"),
                  subtitle: Text("联系人电话 -- 1008${index+1}"),
                );
              },
              separatorBuilder: (BuildContext context,int index){
                return index % 2 == 0 ? redColorDiv : blueColorDiv;
              },
              itemCount: 100
          )
      ),

    );
  }

}